/**
 * 
 */
package com.sidom.movieIndexer.domain.imdb;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;

/**
 * A class representing a Cast member of a movie.
 * @author Siebe
 */
public class Cast {
	/**
	 * The name of the cast member.
	 */
	private String name;
	/**
	 * The character he represents in the movie.
	 */
	private String character;
	
	/**
	 * Constructor.
	 * @param name The name of the Cast member.
	 * @param character The character he plays in the movie.
	 */
	public Cast(String name) {
		super();
		this.name = name;
	}
	
	/**
	 * Constructor.
	 * @param name The name of the Cast member.
	 * @param character The character he plays in the movie.
	 */
	public Cast(String name, String character) {
		this(name);
		this.character = character;
	}
	
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @return the character
	 */
	public String getCharacter() {
		return character;
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public final int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public final boolean equals(final Object obj) {
		if(obj==this){
			return true;
		}
		if(!(obj instanceof Cast)){
			return false;
		}
		Cast castToCheck = (Cast)obj;
		return EqualsBuilder.reflectionEquals(this, castToCheck);
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public final String toString() {
		return ReflectionToStringBuilder.toString(this);
	}
}
